home *** CD-ROM | disk | FTP | other *** search
- Path: muss.CIS.McMaster.CA!not-for-mail
- From: shadowfax
- Newsgroups: comp.lang.c
- Subject: command line argument help
- Date: 27 Jan 1996 10:21:21 -0500
- Organization: McMaster University, Hamilton, Ontario, Canada.
- Sender: u9010255@muss.cis.McMaster.CA
- Message-ID: <4edfth$ok@muss.CIS.McMaster.CA>
- NNTP-Posting-Host: muss.cis.mcmaster.ca
-
- to all the c gods out there:
-
- i am not having too much success with command line arguments. i am
- trying to make a simple sumation executable for dos. i am using borland
- c++ v3.1. what i want as the end result is the user just types:
-
- c:\> sum 6 3
-
- and the executable would output an answer of 9. the following is my program:
-
-
- #include <stdio.h>
- #include <stdlib.h>
-
- int main(char *argv[])
- {
-
- int iSum = 0;
-
- iSum = atoi(argv[1]) + atoi(argv[2]);
- printf("\nthe answer is %d", iSum);
-
- return(0);
- }
-
- when i compile and run, it always outputs an anser of 0. can anyone tell
- me what's wrong?
-
- sf
-
-
-